#include<iostream>
using namespace std;

const int MaxN = 20;
int n, a, ans = 0;
int d[MaxN];

void DFS(int now = 0, int id_1 = -1, int id_2 = -1, int sum_d = 0, int sum_a = 0){
	if(now == n){
		ans = max(sum_d, ans);
		return;
	}
	
	if(id_1 != 1 && id_2 != 1){
		DFS(now + 1, 1, id_1, sum_d + (id_1 ==4 ? d[now]*2 : d[now]), sum_a);
	}
	if(id_1 !=2 &&  id_2 != 2){
		DFS(now + 1, 2, id_1, sum_d, sum_a + a);
	}
	if(id_1 != 3 && id_2 != 3){
		DFS(now + 1, 3, id_1, sum_d + (id_1 == 4 ? sum_a*2 : sum_a), sum_a);
	}
	if(id_1 != 4 && id_2 != 4){
		DFS(now + 1, 4, id_1, sum_d, sum_a);
	}
}

int main(){
	cin >> n >> a;
	for(int i = 0; i < n; i++){
		cin >> d[i];
	}
	
	DFS();
	cout << ans << endl;
	return 0;
}
 
